home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { xTool - Component Collection }
- { }
- { Copyright (c) 1995 Stefan B÷ther }
- { }
- {*******************************************************}
- unit stpWatch;
-
- interface
-
- uses
- WinTypes, WinProcs, SysUtils, Classes, Dialogs, Forms;
-
- type
- TResolution = (resMSeconds,resSeconds,resMinutes,resHours,resTime);
-
- TStopWatch = class(TComponent)
- private
- FBegin, FEnd: TDateTime;
- FStart : Boolean;
- FPause : Boolean;
- FDisplay : Boolean;
- FDisplayText: PString;
- FResolution : TResolution;
- FOnStop : TNotifyEvent;
- FOnStart : TNotifyEvent;
- FOnDisplay : TNotifyEvent;
- function GetDisplayText: String;
- function GetMSeconds: Longint;
- function GetSeconds: Longint;
- function GetMinutes: Longint;
- function GetHours: Longint;
- function GetTime: TDateTime;
- function GetBegin: TDateTime;
- function GetEnd: TDateTime;
- function GetString: String;
- procedure SetDisplayText(Value: String);
- procedure SetStart(Value: Boolean);
- procedure SetPause(Value: Boolean);
- public
- constructor Create(aOwner:TComponent); override;
- destructor Destroy; override;
- procedure Start;
- procedure Stop;
- procedure Pause;
- procedure Resume;
- procedure Show;
- property MSeconds: Longint read GetMSeconds;
- property Seconds: Longint read GetSeconds;
- property Minutes: Longint read GetMinutes;
- property Hours: Longint read GetHours;
- property Time: TDateTime read GetTime;
- property AsString: String read GetString;
- property Paused: Boolean read FPause write SetPause;
- property Started: Boolean read FStart write SetStart;
- published
- property Display: Boolean read FDisplay write FDisplay;
- property DisplayText: String read GetDisplayText write SetDisplayText;
- property Resolution: TResolution read FResolution write FResolution;
- property OnStart: TNotifyEvent read FOnStart write FOnStart;
- property OnStop: TNotifyEvent read FOnStop write FOnStop;
- property OnDisplay: TNotifyEvent read FOnDisplay write FOnDisplay;
- end;
-
- procedure Register;
-
-